package com.example.myblog.service;

import com.example.myblog.entity.UserInfo;
import com.example.myblog.mapper.UserMapper;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

@Service
public class UserService {
    @Resource
    UserMapper userMapper;

    public int register(UserInfo userInfo) {
        return userMapper.register(userInfo);
    }

    public UserInfo getUserByName(String username) {
        return userMapper.getUserByName(username);
    }

    public UserInfo getUserById(Integer id) {
        return userMapper.getUserById(id);
    }

    public UserInfo getUserByEmail(String email) {
        return userMapper.getUserByEmail(email);
    }

    public int updatePhotoById(Integer id, String photoPathRelative) {
        return userMapper.updatePhotoById(id, photoPathRelative);
    }

    public int update(UserInfo userInfo) {
        return userMapper.update(userInfo);
    }
}
